<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

namespace Common\Model;
use Think\Model;
use Org\My\SendSms;
/**
 * 短信记录表model
 */
class  SmsRecordModel extends BaseModel{
    
    /**
     * 验证短信验证码
     * @param type $phone 手机号
     * @param type $code 验证码
     */
    public function checkSmsVericode($phone,$code){
        
        $data['mobile'] = $phone;
        $data['code'] = $code;           
        $_validate = array(
            array('mobile', 'require', '手机号不能为空'),
            array('code', 'require', '短信验证码不能为空'),
        
        );
        
        if (!$this->validate($_validate)->create($data)) {
           
             $result = responseInfo('', $this->getError(),1);
             return $result;
             
        }
        
        $sendClass = new SendSms();
        $tplid = C('SEND_SMS_REGISTER');
        $result = $sendClass->checkSmsCode($phone, $tplid, $code);
        
        return $result;
    }
}